{template 'header','member'}
<div class="main-block bd-gray mt10">
	<div class="hd fn-clear">
		<h2 class="fn-left">车主圈</h2>
	</div>
    <div class="main-nav fn-clear">
        <ul id="data-nav" class="fn-left fn-clear">
            <li id="status_0"><a href="{url('member/my')}?action=car&mid={$mid}"><span>爱车资料</span></a></li>
            <li id="status_1"><a href="{url('member/my')}?action=likecar&status=1&mid={$mid}"><span>我关注的车型</span></a></li>
        </ul>
        <button id="addCar" class="btn fb" action="ownerCar" act="{if $action=='likecar'}addcar{else}car{/if}">添加{if $action=='likecar'}关注车型{else}爱车信息{/if}</button>
    </div>
    <!--添加车型对话框 start-->
    <div style="display: none;">
        <div id="dlg" class="easyui-dialog" style="padding:10px;" data-options="closed:'true'">
            <form name='focusCar' action="{url('member/my')}" method="post" id="addCar-form">
                <input type="hidden" name="action" id='action' value="car"/>
                <input type="hidden" name="mid" value="{$mid}"/>
                <input type="hidden" name="itemid" value="" id='itemid'/>
                <table class="add-car-tb fn-clear">
                    <tr>
                        <td width='200'>请选择车型：</td>
                        <td width='300' id="ownerCarEdit">
                            {Post::autoCombo('post[arbid][]','post[arcid][]', 'post[amid][]',"",'','', 0, 0, 0, true)}
                        </td>
                    </tr>
                    <tr id='by'>
                        <td width='100'>请选择购买日期：</td>
                        <td width='300' id='bytime'>
                            {Post::catTree('post[bytime]', $moduleid, '选择购买日期' , '')}
                        </td>
                    </tr>
                    <tr>
                        <td></td>
                        <td>
                            <button class="btn fn-left mr10" type="submit" id='carbtn'>添加车型</button>
                            <button id="closeDlg" type="button"  class="btn fn-left">取消</button>
                        </td>
                    </tr>
                </table>
            </form>
            </form>
	        <script type="text/javascript">
		        seajs.use(['member'], function(member){
                    $("#addCar-form").submit(function(){
                        return $(this).form('validate');
                    });
		        })
	        </script>
        </div>
    </div>
    <!--添加车型对话框 end-->
    <!--警告对话框 start-->
	<div style="display: none;">
		<div id="warning" class="easyui-dialog" title="警告" style="padding:10px;text-align: center" data-options="closed:'true',width:400,modal:'true'">
		最多只能添加三款爱车车型！
		</div>
	</div>
    <!--警告对话框 end-->
{if $action=='car' || !$action}
<table class="filter-tb mt10 c000 con">
	<thead>
	<tr>
	   <th width='200'>品牌</th>
	   <th width='200'>车系</th>
		<th width='300'>车款</th>
		<th width='200'>购车时间</th>
		<th width='100'>管理</th>
	</tr>
	</thead>
	{if $item['arbid'][0]}
	{loop $item[brand] $k=>$v}
	<tr class="js-focus-car">
		<td ><a href="{$v['linkurl']}" target="_blank">{$v[name]}</a></td>
		<td ><a href="{$item[car][$k][linkurl]}" target="_blank">{$item[car][$k][name]}</a></td>
		<td><a href="{url('auto/car', 'carid='.$item['model'][$k]['amid'])}" target="_blank">{$item[model][$k][name]}</a></td>
		<td class="c666">
		{if $item['bytime'][$k]=='3714'}1-3个月{/if}
		{if $item['bytime'][$k]=='3715'}3-6个月{/if}
		{if $item['bytime'][$k]=='3716'}6-12个月{/if}
		{if $item['bytime'][$k]=='3717'}1-2年{/if}
		{if $item['bytime'][$k]=='3718'}2年以上{/if}
		</td>
		<td class="pub-oper">
			<a class="edit" title='修改车型' href="javascript:void(0);" action="ownerCar" act='edit'  amid={$item[model][$k][amid]} itemid={$k} bytime={$item[bytime][$k]}>编辑</a>
			<a class="del" title='删除车型' href="{url('member/my')}?action=delete&mid={$mid}&itemid={$k}&status=1" onclick="return confirm('确定要删除吗？此操作将不可撤销');">删除</a>
		</td>
	</tr>
	{/loop}
	{else}
	<tr>
	<td colspan="5">暂无爱车信息，请点击添加！</td>
	</tr>
	{/if}
</table>
<form method="post" class="form" action="{url('member/my')}" id="pub-form" name="pub-form" >
<input type="hidden" name="action" value="area"/>
<input type="hidden" name="mid" value="{$mid}"/>
<table class="data-form">
<tr>
	<th width="50">我的位置</th>
	<td class="tr">
        <input type="text" id="location" name="post[areaid]" readonly="readonly" value="{if $item['areaid']}{area_pos($item['areaid'],'&nbsp;')}{else}{area_pos($mareaid,'&nbsp;')}{/if}" size='40' class=" graybd-ipt fn-left mr10"/>
        <button id="markLoc" class="btn fn-left" type="button">标注位置</button>
        <input type="hidden" id="point" name="post[zuobiao]"  value="{$item['zuobiao']}"/>
    </td>
</tr>
<tr>
	<th></th>
	<td class="sub-info"><button type="submit" class="btn">保 存</button></td>
</tr>
</table>
</form>
<!--地图容器-->
<div id="mapDlgWrap" style="display:none;">
<div id="mapDlg" class="easyui-dialog" title="标注位置" style="padding:10px;text-align: center" data-options="closed:'true'">
    <p style="text-align:left;color:red;">温馨提示：您可以在地图中点击右键添加标注。</p>
    <iframe width="500" height="350" border='0' src="{SITE_URL}api.php?aM=map&aA=member&city={if $item['zuobiao']}{$item['zuobiao']}{elseif $item['mareaname']}{urlencode($item['mareaname'])}{else}{urlencode('中国')}{/if}" frameborder='0' scrolling="no"></iframe>
</div>
</div>
{/if}
{if $action=='likecar' }
<div class="filter con fn-clear">
	<form action="{url('member/my')}">
		<input type="hidden" name="action" value="{$action}"/>
		<input type="hidden" name="mid" value="{$mid}"/>
	</form>
</div>
		<table class="filter-tb mt10 c000 con">
			<thead>
			<tr>
				<th width='200'>品牌</th>
				<th width='200'>车系</th>
				<th width='300'>车款</th>
				<th width="150">添加时间</th>
				<th width="80">管理</th>
			</tr>
			</thead>
			<tbody id="pub-list">
			{if $lists}
			{loop $lists $k $v}
			<tr >
				<td width='120'>&nbsp;<a href="{$v['brand']['linkurl']}" target="_blank">{$v['brand']['name']}</a>&nbsp;</td>
				<td width='120'>&nbsp;<a href="{$v['car']['linkurl']}" target="_blank">{$v['car']['name']}</a>&nbsp;</td>
				<td>&nbsp;<a href="{url('auto/car', 'modelid='.$v['amid'])}" target="_blank">{$v['model']['name']}</a>&nbsp;</td>
				<td class="c666">{date('Y-m-d',$v[addtime])}</td>
				<td class="pub-oper">
					<a class="edit"  title='修改车型' href="javascript:void(0);" act="editcar" action='ownerCar' arbid={$v[brand][arid]} arcid={$v[car][arid]} amid={$v[model][amid]} itemid={$v[itemid]} >编辑</a>
					<a class="del" title='删除车型' href="{url('member/my')}?action=delcar&mid={$mid}&itemid={$v[itemid]}&status=1" onclick="return confirm('确定要删除吗？此操作将不可撤销');">删除</a>
				</td>
			</tr>
			{/loop}
			{else}
			<tr >
				<td colspan="5">暂无关注车型,请点击添加！</td>
			</tr>
			{/if}
			</tbody>
		</table>
	<div class="pages con fn-clear">
		<span class="sum fn-right">共{php echo $do->getPn()->getPages()}页</span>
		<ul class="fn-right fn-clear">
			{php $do->getPn()->render()}
		</ul>
	</div>
{/if}
<script type="text/javascript">
    seajs.use(['member'], function(member){
        member.active('', 'mid_owners', 'status_{if $status}{$status}{else}0{/if}')
    })
</script>
</div>
{template 'footer','member'}